package com.htsk.city.services.core.dao;


import com.htsk.city.services.core.domain.Role;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * (Role)表数据库访问层
 *
 * @author makejava
 * @since 2024-09-25 18:13:08
 */
public interface RoleDao extends JpaRepository<Role,Integer> {
    @Query(value = "SELECT r.* from role r WHERE r.id in (SELECT sr.role_id from sys_user_role sr WHERE sr.user_id=?1)",nativeQuery = true)
    List<Role> queryRoleByUserId(int userId);
}

